// pages/myself/myself.js
//获取应用实例
var util = require('../../utils/util.js');
var userService = require('../../services/userService.js');
var app = getApp()
Page({
  data:{
    userAvatar: '',
    userNickName: '',
    userId: '',
    userInfo:{}
  },
  clickReturn:function(e){
    wx.navigateBack();
  },
  clickActive:function(e){
    wx.navigateTo({
      url: '../interface/interface'
    });
  },
  clickTeam:function(e){
    wx.navigateTo({
      url: '../groupList/groupList'
    });
  },
   clickSetup:function(e){
    wx.navigateTo({
      url: '../setup/setup'
    });
  },
  clickCredits:function(e){
    wx.navigateTo({
      url: '../credits/credits'
    });
  },
  onLoad:function(options){
    util.checkPermission(this, options);
    this.centerUserInfo();
    this.setData({
      userAvatar: app.globalData.sysUserInfo.avatar,
      userNickName: app.globalData.sysUserInfo.nickname,
    })
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  },
  Dataset: function (e) {
    wx.navigateTo({
      url: '../dataset/dataset'
    });
  },
  centerUserInfo:function(){
    var that = this;
    userService.centerUserInfo({
      user_id: app.globalData.apiUser,
      success:function(res){
        that.setData({
          userInfo:res
        })
      }
    })
  }
})